//
//  AppDelegate.m
//  Air3DViewDemo
//
//  Created by limu on 16/5/19.
//  Copyright © 2016年 SimuTech. All rights reserved.
//

#import "AppDelegate.h"
#import "LoginViewController.h"
#import "AirSurfaceEngine.h"
#import "CusNavViewController.h"
//#define AirKey @"cubIFQ/cTaCAX/QlBqOsDyLRuqz0WvX+ykEKA06cXxCHCNXj+CHtvsygHlXBaBJMfTR3o67CpCjvOJFWj1mrcWyihk+mAJq089gWsQ2LnAS7vANsKiXkupF1n2A9MWB3pyeExcYh8+4G8X1CHj/pph8Giwbl1Z6ZvPyfAtDQ/Poxp5w3N7mBiSJJfw/mrBJhb3cQuFWqbyjVV5hvROMA44t9VaP1JejoyEBRNUNcnrv9ezeJuaUhByEA/4j3kRRZFDHO0jeppBDAfGPctL+g2lkb2Ehr0FuHkrjtsyoP/p0cWoDa+R8m988rbefXPuluamXw6lenDzKH1qDpKhyOMw==" com.simu-tech.Air3DViewDemo


#define AirKey @"ivIcKnXS94yDHbxNzLObU78ePckuDlVwKb3xoVzpkNMqBtbXzStIfbMUtKlUpfvuv4bVub4XWI1eNcFntCz/Bo5zwkkthVQXKjl22hflKk/badbNzyHx/Vje0+T9eCQw1T59iCTxqFlplbjz8CWiRk/uGv61Pw7LdgjOgNqFqwkcltpVXFM1lD6ldleBnXhy2bcp4po+YPRCHMjxC5bW8jq7nsgNOZwPZ0m6qJhJVKEkS4bIVaidG337flk5/Kw2ydI6f5WJN5piBrxETPcMOd8MVk/dZrKmIR428l7OeEXdFYNcn6fvrES2hnpe1Qmch57vv0OxELXiZ4CZTSWzdA=="




@interface AppDelegate ()<AirSurfaceGeneralDelegate>
@property (nonatomic, strong) LoginViewController * viewController;
@property (nonatomic, strong) AirSurfaceEngine * airSurfaceEngine;
@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    /**
     启动管理器
     */
    self.airSurfaceEngine = [[AirSurfaceEngine alloc] init];
    [_airSurfaceEngine start:AirKey generalDelegate:self];
    
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    self.viewController = [[LoginViewController alloc] init];
    UINavigationController *navc = [[UINavigationController alloc]initWithRootViewController:self.viewController];
    

    
    self.window.rootViewController = navc;
    
    [self.window makeKeyAndVisible];
    return YES;
}

#pragma mark - AirSurfaceGeneralDelegate
/**
 *返回网络错误
 *@param iError 错误号
 */
- (void)onGetNetworkState:(AirSurfacePermissionCheckResultCode)iError {
    
}

/**
 *返回授权验证错误
 *@param iError 错误号 : 为0时验证通过
 */
- (void)onGetPermissionState:(AirSurfacePermissionCheckResultCode)iError{
    if (iError == PermissionCheck_OK) {
        NSLog(@"AIR-3D鉴权成功");
    } else {
        NSLog(@"AIR-3D Error: %d", iError);
    }
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
////此方法会在设备横竖屏变化的时候调用
//- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
//{
//    
//    //   NSLog(@"方向  =============   %ld", _allowRotate);
//    if (_allowRotate == 1) {
//        return UIInterfaceOrientationMaskAll;
//    }
//        return (UIInterfaceOrientationMaskPortrait);
//    
//}
//
//
//// 返回是否支持设备自动旋转
//- (BOOL)shouldAutorotate
//{
//    if (_allowRotate == 1) {
//        return YES;
//    }
//    return NO;
//}

@end
